package com.wit.service.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Property;

import com.wit.dao.SubcompanyDao;
import com.wit.po.Company;
import com.wit.po.Subcompany;
import com.wit.service.SubcompanyService;

public class SubcompanyServiceImpl implements SubcompanyService {

	private SubcompanyDao subcompanyDao;
	
	public SubcompanyDao getSubcompanyDao() {
		return subcompanyDao;
	}

	public void setSubcompanyDao(SubcompanyDao subcompanyDao) {
		this.subcompanyDao = subcompanyDao;
	}

	
	public boolean addSubcompany(Subcompany subcompany) {
		// TODO Auto-generated method stub
		return subcompanyDao.addSubcompany(subcompany);
	}

	
	public boolean deleteSubcompany(Subcompany subcompany) {
		// TODO Auto-generated method stub
		return subcompanyDao.deleteSubcompany(subcompany);
	}

	
	public List<Subcompany> findSubcompanyByCompany(Company company) {
		// TODO Auto-generated method stub
		DetachedCriteria dc = DetachedCriteria.forClass(Subcompany.class);
		dc.add(Property.forName("company").eq(company));
		return subcompanyDao.findSubcompanyByCondition(dc,0,Integer.MAX_VALUE);
	}

	
	public List<Subcompany> findSubcompanyByCondition(DetachedCriteria dc,Integer startRecord, Integer endRecord) {
		// TODO Auto-generated method stub
		return subcompanyDao.findSubcompanyByCondition(dc,startRecord,endRecord);
	}

	
	public Subcompany findSubcompanyByIdentifier(String subCompanyId) {
		// TODO Auto-generated method stub
		return subcompanyDao.findSubcompanyByIdentifier(subCompanyId);
	}

	
	public boolean modifySubcompany(Subcompany subcompany) {
		// TODO Auto-generated method stub
		return subcompanyDao.modifySubcompany(subcompany);
	}

	
	public Integer findSubcompanyCount(DetachedCriteria dc) {
		// TODO Auto-generated method stub
		return subcompanyDao.findSubcompanyCount(dc);
	}

}
